package com.cl.mybatis.learn.day15;

import java.io.InputStream;

import com.cl.mybatis.learn.day15.bean.Orders;
import com.cl.mybatis.learn.day15.dao.OrdersMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import com.cl.mybatis.learn.day15.bean.User;

public class Mybatis001 {
    public static void main(String[] args) throws Exception {
        
        String resource = "common1/mybatis-config.xml";
        InputStream inputStream = Resources.getResourceAsStream(resource);
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
        SqlSession session = sqlSessionFactory.openSession();
        OrdersMapper mapper = session.getMapper(OrdersMapper.class);

        
        try {
            Orders orders= mapper.selectById2(12);
            System.out.println("orders：" + orders);
        } finally {
            session.close();
        }
        
    }
    
}
